<?php
global $_RQ,$_AR;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
if($_RQ['op']=='main'){
	$red=$this->model('red')->gored();
	$return['red']=$red;
	$return['params']=array('cid'=>intval($_RQ['cid']));
	$sharelink='jy_getred/index//fromuser='.$_SESSION['uid'];
	$return['sharedata']=array(
			'title'=>$return['pluginset']['share_title']?$return['pluginset']['share_title']:'首页-抢红包有礼活动',
			'desc'=>$return['pluginset']['share_desc']?$return['pluginset']['share_desc']:'抢红包有礼活动，一个属于自己的抢红包有礼活动！',
			'link'=>custom_url($sharelink,true),
			'imgUrl'=>tomedia($return['pluginset']['share_image'])
	);
	set_html('title',$return['pluginset']['title']?:'抢红包有礼活动');
	exi($return);
}
if($_RQ['op']=='list'){
		$pindex = max(1, intval($_RQ['page']));
		$psize = 20;
		$total='';
		$params=array('uniacid'=>$_SESSION['uniacid'],'mid'=>$_SESSION['uid'],'isjian'=>0);
		$list=pdo_getslice('jy_getred_redlog',$params,array($pindex,$psize),$total,$fields,'','id desc');
		if($list){
			foreach($list as &$item){
				$item['member']=cfc('core')->member_show($item['mid']);
				$item['typetitle']=$this->jiangtype[$item['type']];
				$item['createtime']=date('Y-m-d H:i:s',$item['createtime']);
			}
		}
		$return['list']=$list;
		exi($return);
}
if($_RQ['op']=='gored'){
	$red=$this->model('red')->gored();
	exi($red);
}
if($_RQ['op']=='getred'){
	$jiangitem=$this->model('red')->getred('',$_RQ['sendredlogid']);
	$jiangitem['typetitle']=$this->jiangtype[$jiangitem['type']];
	if($jiangitem['type']<=2){
		exi('恭喜抽中【'.$jiangitem['typetitle'].'】'.$jiangitem['fee'].'个！');
	}else{
		exi('恭喜抽中一张【'.$jiangitem['typetitle'].'】！');
	}
}
?>